<%@ include file="/webpage/include/taglib.jsp" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>

    <link rel="stylesheet" href="${ctxStatic}/plugin/layui2.0/css/layui.css" media="all">
    <link rel="stylesheet" href="${ctxStatic}/plugin/layui2.0/css/modules/layer/default/layer.css" media="all">

    <link rel="stylesheet" href="${ctxStatic}/plugin/bootstrap/css/bootstrap.css" media="all">


    <script type="text/javascript" src="${ctxStatic}/plugin/vue/vue.min.js"></script>
    <script type="text/javascript" src="${ctxStatic}/plugin/layui2.0/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="${ctxStatic}/plugin/layui2.0/layui.js"></script>
    <script src="${ctxStatic}/plugin/layui2.0/lay/modules/layer.js"></script>

    <script type="text/javascript" src="${ctxStatic}/plugin/bootstrap/js/bootstrap.js"></script>
    <script type="text/javascript">
        var orderId='${orderId}';
    </script>
    <style>
        .title {
            background: #efefef;
            color: #333;
            font-weight: 600;
        }

        .item {
            padding: 6px 0;
        }

        .container {
            font-size: 14px;
            color: #666;
        }

        .card {
            margin: 0 -15px;
            padding: 15px;
            width: auto !important;
        }

        .card .top {
            color: #333;
            font-weight: 600;
        }
    </style>

</head>

<body>

    <div id="app" class="container">
        <!-- 订单信息 -->
        <div class="card" style="width: 100%;">
            <div class="top"> 订单编号：{{ order.orderNo }} </div>
            <div> 客户：{{ order.customerName }} </div>
            <div> 地址：{{ order.address }} </div>
            <div> 联系人：{{ order.contact }} <span>&nbsp;{{ order.phone }}</span></div>
        </div>

        <!-- 订单list -->
        <div v-for="item in list" style="margin-top:20px;">
           <!--  <div class="row item title">
                <div class="col-9">{{ item.storageName }}</div>
                <div class="col-3"> 购买数量</div>
            </div> -->
            <div class="row item" v-for="sub in item.orderSpecList">
                <div class="col-9">{{ sub.name }}</div>
                <div class="col-3">{{ sub.amount }}</div>
            </div>
        </div>

    </div>

</body>

</html>

<script>
    console.log('layer', layer);

    let app = new Vue({
        el: "#app",
        data: {
            name: 'xiao',
            order: {},
            list: []
        },
        methods: {
            getList: function () {
                let index = layer.load();
                $.ajax({
                    type: "POST",
                    url: "${ctx}/sc/order/order/findOrderCustomerByOrderId?orderId="+orderId,
                    success: res => {
                        layer.close(index);
                        this.order = res || {};
                        this.list = this.order.orderStorageList || [];
                    },
                    error: err => {
                        layer.close(index);
                        alert('数据请求失败！');
                    }
                });
            }
        },
        created: function () {
            console.log('created');
            this.getList();
        }
    })
</script>